package com.cx.common.core.dto.response;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import lombok.experimental.SuperBuilder;

import java.io.Serializable;

/**
 * 基础响应结果
 *
 * @author _
 * @date 2020-08-24
 */
@ApiModel(description = "基础响应结果")
@SuperBuilder(builderMethodName = "sBuilder")
@Accessors(chain = true)
@Data
@NoArgsConstructor
@AllArgsConstructor
public class BaseResp implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 响应码
     */
    @ApiModelProperty(value = "响应码", required = true, example = "0000")
    private String code;

    /**
     * 消息
     */
    @ApiModelProperty(value = "消息", required = true, example = "成功")
    private String msg;

    /**
     * 文件域名
     */
    @ApiModelProperty(value = "文件域名")
    private String fileDomain;

    public boolean success() {
        return RespCode.SUCCESS.getCode().equals(code);
    }
}
